Skip to content

Conversation

@DSingh0304
Copy link
Contributor

@DSingh0304 DSingh0304 commented Nov 8, 2025

Why submit this pull request?

  • Bugfix
  • New feature provided
  • Improve performance
  • Backport patches

What changes will this PR take into?

This PR adds comprehensive E2E tests for the Global Rules resource, covering all CRUD operations and list page functionality.

Test Coverage (5 tests, all passing ✅):

  • List page tests (global_rules.list.spec.ts) - 3 tests

    • Navigation to global rules page
    • Pagination using table controls
    • Pagination using URL search parameters
  • CRUD with required fields (global_rules.crud-required-fields.spec.ts) - 1 test

    • Uses single plugin (response-rewrite)
    • Tests create and delete operations
  • CRUD with all fields (global_rules.crud-all-fields.spec.ts) - 1 test

    • Uses multiple plugins (response-rewrite + cors)
    • Tests create and delete operations with complex configurations

Files Added:

  • e2e/pom/global_rules.ts - Page Object Model with navigation helpers and assertions
  • e2e/tests/global_rules.list.spec.ts - List page and pagination tests
  • e2e/tests/global_rules.crud-required-fields.spec.ts - Single plugin CRUD tests
  • e2e/tests/global_rules.crud-all-fields.spec.ts - Multiple plugins CRUD tests

Implementation Details:

  • Uses Monaco editor for plugin JSON configuration (consistent with plugin_configs)
  • Proper handling of delete confirmation dialogs
  • Follows test patterns from routes, services, and plugin_metadata
  • Proper cleanup with deleteAllGlobalRules helper
  • Auto-generated ID capture and verification

Related issues

Closes #3088

Checklist:

  • Did you explain what problem does this PR solve? Or what new features have been added?
  • Have you added corresponding test cases?
  • Have you modified the corresponding document? (N/A - E2E tests don't require documentation updates)
  • Is this PR backward compatible? If it is not backward compatible, please discuss on the mailing list first (Yes, only adds tests, no breaking changes)

- Added global_rules POM with navigation and assertions
- Added list test with pagination support (11 items)
- Added CRUD test with required fields (single plugin)
- Added CRUD test with all fields (multiple plugins)
- Tests verify create and delete functionality
- All 5 tests passing

Closes apache#3088
Restored comments for clarity on configuration options.
@SkyeYoung SkyeYoung changed the title test: add E2E tests for global rules (#3088) test: add E2E tests for global rules Nov 21, 2025
@SkyeYoung SkyeYoung requested a review from Copilot November 21, 2025 01:52
@SkyeYoung SkyeYoung merged commit 9a7661b into apache:master Nov 21, 2025
10 checks passed
Copilot finished reviewing on behalf of SkyeYoung November 21, 2025 01:56
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds comprehensive E2E test coverage for the Global Rules resource, introducing 5 new tests across 3 test files and a new Page Object Model (POM) file. The implementation follows existing patterns from routes and upstreams tests.

Key Changes:

  • Added Page Object Model for global rules navigation and assertions
  • Added list page tests with pagination functionality (3 tests)
  • Added CRUD tests for both minimal and complex plugin configurations (2 tests)

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
e2e/pom/global_rules.ts Page Object Model with navigation helpers and assertions for global rules, following the routes POM pattern
e2e/tests/global_rules.list.spec.ts List page tests including navigation, component visibility checks, and pagination tests with 11 test global rules
e2e/tests/global_rules.crud-required-fields.spec.ts CRUD test using single plugin (response-rewrite) with minimal configuration; covers create and delete operations
e2e/tests/global_rules.crud-all-fields.spec.ts CRUD test using multiple plugins (response-rewrite + cors) with complex configurations; covers create and delete operations

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

.click();

await globalRulePom.isIndexPage(page);

Copy link

Copilot AI Nov 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing whitespace detected. Please remove the whitespace at the end of this line.

Suggested change

Copilot uses AI. Check for mistakes.
.click();

await globalRulePom.isIndexPage(page);

Copy link

Copilot AI Nov 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing whitespace detected. Please remove the whitespace at the end of this line.

Suggested change

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test(resource): global rules

3 participants